<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    // function fb(first,second){
    //     fb(1,1)

    // }
    // var first = 1,second = 1,third = 0;
    // for(var i = 0;i<10-2;i++){
    //     third = first+second;
    //     first = second;
    //     second = third;
    // }
    // console.log(third)
    var bigNum = ["零","壹","贰","叁","肆","伍","陆","柒","捌","玖","拾"]
    var numUnit = ["拾","佰","仟","萬","拾萬","佰萬","仟萬","亿","拾亿"]
    function findBigNum(num){ 
        return bigNum[num] 
    }
    function transform(num){
        stringNum = String(num)
        transNum = []
        for(var i = 0;i<stringNum.length;i++){

            if(stringNum[i]!=0 || (i==1 && stringNum[i]==0)){
                if(i==1 && stringNum[i]==0){
                    transNum.push(findBigNum(0))
                    continue
                }
                transNum.push(findBigNum(stringNum[i]))
                if(i!=stringNum.length-1)
                transNum.push(numUnit[stringNum.length-(i+2)])
            }
        }
        return(String(transNum))
    }
    console.log(transform(101011101))
</script>
</html>

